import java.net.Socket;

public class Serwer {
	Socket socket ;
	private Connection conn;
    private ConnectionWriter writer;
    //private ConnectionReader reader;
	private void netInit() {
		try{
    	 conn= new Connection(socket);
         writer = new ConnectionWriter(conn);
         writer.start();

         //reader = new ConnectionReader(conn,this) ;
         //reader.start();
        
    	} catch(Exception e) { System.out.println(e.getMessage()); 
    	
    	};
    }
	public void addMessage(Message m)
	{
		writer.addToQueue(m) ;
		
	}
	protected void handleMessage(Message m) {
		
		System.out.println("Przetwarzam wiadomosc od serwera danych : " +m.getCommand()) ;
		
	}
	public Serwer(Socket s)
	{
		socket = s ;
		netInit() ;
	}
}